<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-TW" xml:lang="zh-TW">
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<meta name="robots" content="noindex">
	<meta name="description" content="Your description goes here" />
	<meta name="keywords" content="your,keywords,goes,here" />
	<meta name="author" content="Your Name" />
	<link rel="stylesheet" type="text/css" href="/css/coplay_layout.css"  media="screen,projection" />
	<link rel="stylesheet" type="text/css" href="/css/facebox.css" />
	<link rel="stylesheet" type="text/css" href="/css/activity-edit.css" />
	<link rel="stylesheet" type="text/css" href="/css/personal.css" />
	<link rel="stylesheet" type="text/css" href="/css/activity.css" />
	<link rel="stylesheet" type="text/css" href="/css/activity_list.css" />
	<link rel="stylesheet" type="text/css" href="/css/fileuploader.css" />
	<link rel="stylesheet" type="text/css" href="/css/pikachoose.css" />
	<link rel="stylesheet" type="text/css" href="/css/datePicker.css"/>
	<link rel="stylesheet" type="text/css" href="/css/list_gridview.css"/>
	
	<script src="/js/jquery.min.js"></script>
	
	<script src="/js/plugins/jquery-ui.min.js"></script>
	<script type="text/javascript" src="/js/jquery.json-2.2.min.js" ></script>
	<script src="/js/plugins/jquery.isotope.min.js"></script>
	<script src="/js/plugins/jquery.imagesloaded.js"></script>
	<script src="/js/plugins/jquery.cycle.js"></script>
	
	<script type="text/javascript" src="/js/plugins/facebox.js"></script>
	<script type="text/javascript" src="/js/ajax.js"></script>
	<script src="/js/tiny_mce/tiny_mce.js"></script>
	<script src="/js/image_uploader/fileuploader.js"></script>
	<script src="/js/image_uploader/uploader_function.js"></script>
	<script src="/js/plugins/AjaxFormSubmitter.js"></script>
	<script src="/js/plugins/jquery.pikachoose.full.js"></script>
	<script src="/js/jquery.datePicker.js" type="text/javascript"></script>
	<script src="/js/date.js" type="text/javascript"></script>
	<script src="http://connect.facebook.net/zh_TW/all.js"></script>
	<title>Coplay 匠玩 | 經營/參加/分享所有你想跟大家一起玩的事兒</title>
	<script>
		var loc = window.location.pathname.split('/');
		if(loc[1]=='activity_edit'){
			window.onbeforeunload = askConfirm;
			$(window).unload(function() {
 				 deleteTempFiles();
			});
		}
		
			
		$(document).ready(function(){
			
			$(".switch_thumb").toggle(function(){
				$(this).addClass("swap");
				$("ul.display").fadeOut("fast", function() {
				$(this).fadeIn("fast").addClass("thumb_view");
			});
			}, function () {
				$(this).removeClass("swap");
				$("ul.display").fadeOut("fast", function() {
				$(this).fadeIn("fast").removeClass("thumb_view");
			});
			});
			
			var $container = $('#activities_area');
			$container.imagesLoaded( function(){
	        	$container.isotope({
	                itemSelector: '.content',
	                layoutMode: 'masonry',
					columnWidth: '220px',
	                animationOptions: {
	                    duration: 500,
	                    easing: 'linear',
	                    queue: false
	                }
	            });
            });
			
			
		if($("#pikame").length>0){
			$("#pikame").PikaChoose({autoPlay:false});		
		}
			
        $("#tabs li").click(function() {
	        //  First remove class "active" from currently active tab
	        $("#tabs li").removeClass('active');
	 
	        //  Now add class "active" to the selected/clicked tab
	        $(this).addClass("active");
	 
	        //  Hide all tab content
	        $(".tab_content").hide();
	 
	        //  Here we get the href value of the selected tab
	        var selected_tab = $(this).find("a").attr("href");
	 
	        //  Show the selected tab content
	        $(selected_tab).fadeIn();
	 
	        //  At the end, we add return false so that the click on the link is not executed
	        return false;
    	});
    	if($('#thumbnail-fine-uploader').length > 0){
	    	var thumbnailuploader = new qq.FileUploader({
				element: $('#thumbnail-fine-uploader')[0],
				action: '/image_uploader/uploadToTemp',
				debug: false,
				multiple: false,
				allowedExtensions: ['jpeg', 'jpg', 'gif', 'png'],
				sizeLimit: 5120000,
				uploadButtonText: '選擇圖片',
				onSubmit: function(id, fileName) {
					var emptyCcount = 0;
					$('#image-thumbnail').find('.empty-image').each(function(i) {
						emptyCcount++;
					});
					
					if(emptyCcount==0){
						alert('reach the upload limit !!');
						return false;
					}
				},
				onComplete: function(id, fileName, responseJSON) {
					if (responseJSON.success) {
						//$('#thumbnail-fine-uploader').append('<img src="images/addnew_btn.jpg" alt="' + fileName + '">');
						$('#image-thumbnail').find('.empty-image').each(function(i) {
							//if($(this).attr('class') == 'empty-image'){
								$(this).html(responseJSON.thumbs+'<input type="hidden" name="upload_image[]" value="'+responseJSON.filename+'" /><div onclick="cancelUpload(this,\''+responseJSON.filename+'\')" class="cancel_btn">cancel</div>');
								$(this).attr('class','upload-image');
								$('.qq-upload-success').fadeOut(6000);
							//}
							return false;
						});
					}
				}
			});
    	}
		
		$(".thumbnails").hover(
			function()
			{	
				$(this).find(".cancel_btn").show();
			},
			function()
			{
				$(this).find(".cancel_btn").hide();
		});
		
		if($('#action_msg').html() != ''){
			$('#action_msg').fadeOut(4000);
		}
		
		$('.activities_organizer').cycle({
            fx: 'scrollHorz',
            prev: '#prev_organizer',
            next: '#next_organizer',
            timeout: 0
        });
        
        $('.date-pick').datePicker({startDate:'2012-11-01'});
		
	});	
	
    $(function(){
		
        $('#query_button').bind('click', function(){
            searchFeed(0,$("#search").val());
        });
		
		
        $(window).scroll(function(){
        	/*detect wrapper height to show go to top button*/
            // get the height of #wrap
            /*
            var h = $('#wrap').height();
            var h_offset = $('#wrap').get(0).offsetHeight;
            var y = $(window).scrollTop();
            */
            
            /*detect wrapper height to show content automatically*/
           /*
		    if (h - y < 600) {
		       
		    }
		    */
        });
		
        $('a[rel*=facebox]').facebox({
            loadingImage: '/images/facebox/loading.gif',
            closeImage: '/images/facebox/closelabel.png'
        });
		
        
        if ($("#UserNav").length > 0) {
            $("#UserNav").click(function(){
                //$(this).find("ul").show()
                $(".navigations").hide();
                $("#user_nav").slideToggle();
            });
        }
       
    });
    
    tinyMCE.init({
		// General options
		mode : "textareas",
		theme : "advanced",
		plugins : "jbimages,autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,visualblocks",

		// Theme options
		theme_advanced_buttons1 : "jbimages,|bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
		theme_advanced_buttons2 : "outdent,indent,blockquote,|,undo,redo,|anchor,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
		theme_advanced_buttons3 : "tablecontrols,|charmap,emotions,iespell,advhr,|,ltr,rtl,|,fullscreen",
		//theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft,visualblocks",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true,
		relative_urls:false,

		// Example content CSS (should be your site CSS)
		content_css : "/css/tinymce/content.css",

		// Drop lists for link/image/media/template dialogs
		template_external_list_url : "/js/tiny_mce/lists/template_list.js",
		external_link_list_url : "/js/tiny_mce/lists/link_list.js",
		external_image_list_url : "/js/tiny_mce/lists/image_list.js",
		media_external_list_url : "/js/tiny_mce/lists/media_list.js",

		// Style formats
		style_formats : [
			{title : 'Bold text', inline : 'b'},
			{title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},
			{title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},
			{title : 'Example 1', inline : 'span', classes : 'example1'},
			{title : 'Example 2', inline : 'span', classes : 'example2'},
			{title : 'Table styles'},
			{title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}
		],

		// Replace values for the template plugin
		template_replace_values : {
			username : "Some User",
			staffid : "991234"
		}
	});
	
	
	</script>
</head>
<body>
	<div id="temp_response_content"></div>
	<div id="menu_bar">
		<div id="stareit">
			<a href="/"><img src="/images/public/logo.png"/><!--<span></span>--></a>
			<?php //echo $site_features;?>
		</div>
		<!--<div id="search_wrap">
			<input onclick="if(this.value == 'Search' ){this.value = ''}" type="text" value="Search" size="27" name="q" id="search" class="ui-autocomplete-input" autocomplete="off" role="textbox" aria-autocomplete="list" aria-haspopup="true" />
			<a class="lg" href="javascript:;" id="query_button"><img alt="" src="/images/search.gif" /></a>
		</div>-->
		<?php //echo $login_form; ?>
		<!--<div id="hot_searches">
			<a href="javascript:getHotSearches();">熱搜</a>
		</div>-->
		<div id="login">
			<?php if($this->tank_auth->is_logged_in()){ 
			?>
				<?php echo 'Hi,'.$username;?><span style="color:#996600;padding:0 2px 0 4px;">|</span>
				<a href="/personal">個人後台</a><span style="color:#996600;padding:0 2px 0 4px;">|</span>
				<a href="/activity_edit">新增活動</a><span style="color:#996600;padding:0 2px 0 4px;">|</span>
				<a href="javascript:logoutForm();" >登出<span></span></a>
			<?php }else{ ?>
				<a href="javascript:loginForm();" >登入<span></span></a>
			<?php } ?>
		</div>
	</div>
	<!--<div id="category_nav" class="navigations">-->
		<?php //echo $category_nav; ?>
	<!--</div>-->
	<?php 
	 if($_SERVER["REQUEST_URI"]=='/' || $_SERVER["REQUEST_URI"]=='/activity_list'){
	?>
	<div id="search_feature" style="" class="navigations">
		<?php echo $search_feature; ?>
	</div>
	<?php } ?>
	<div id="user_nav" style="display:none;" class="navigations">
		<?php //echo $user_nav; ?>
	</div>
    <?php //echo $category_form; ?>
